package com.git.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.git.domain.Book;
import com.git.mapper.DemoMapper;
import com.git.mapper.DemoSqlMapper;
import com.git.repository.BookRepository;
import com.git.service.DemoService;

@Service
public class DemoServiceImpl implements DemoService {
	@Autowired
	private DemoMapper demoMapper;
	private DemoSqlMapper demoSqlMapper;
	
	@Autowired
	private BookRepository bookRepository;
	@Override
	public void init() {
		Book save = this.bookRepository.save(new Book(1, 80, "文学", "这是一本文学书"));
		System.out.println(save);
	}
	@Override
	public List<Book> searchType(String key) {
		return this.bookRepository.findByType(key);
	}
	@Override
	public List<Book> searchContext(String key) {
		return this.bookRepository.findByContext(key);
	}
}
